﻿using NetMicro.EventBus.Enums;

namespace NetMicro.EventBus.Messages
{
    /// <summary>
    /// 消息执行结果
    /// </summary>
    public class MessageReceiveResult
    {

        /// <summary>
        /// 消息执行状态
        /// </summary>
        public MessageReceive MessageReceive { get; set; }

        /// <summary>
        /// 异常信息
        /// </summary>
        public string ExceptionMsg { get; set; }

        /// <summary>
        /// 成功状态
        /// </summary>
        /// <returns></returns>
        public static MessageReceiveResult Success()
        {
            return new MessageReceiveResult
            {
                MessageReceive = MessageReceive.Success
            };
        }
        /// <summary>
        /// 失败状态
        /// </summary>
        /// <returns></returns>
        public static MessageReceiveResult Fail(string exception)
        {
            return new MessageReceiveResult
            {
                MessageReceive = MessageReceive.Failed,
                ExceptionMsg = exception
            };
        }
    }
}
